#!usr/bin/env python
# -*- coding:utf-8 _*-
"""
@author:zhuyan
@file: calculate.py
@time: 2018/10/06
"""
import numpy as np


class Calculate:

    def statistic(self):
        arr = np.arange(16).reshape(4,4)
        print((arr > 10).sum())
        print(arr)
        print(arr.sum(axis=1))
        print(np.mean(arr))

    def sort(self):
        arr = np.random.randn(5,4)
        print(arr.sort())
        # 随机生成2*2*4的矩阵
        a = np.random.normal(size=(2, 2, 4))
        print(a)

    def walk(self):
        position = 0
        walk =[position]
        steps=1000
        for i in np.xrange(steps):
            step = 1 if np.random.randint(0,1) else -1
            position +=step
            walk.append(position)

        print(walk)


if __name__ == '__main__':
    c = Calculate()
    # c.statistic()
    c.sort()
